<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>后台管理--编程之友BBS</title>
    <link rel="stylesheet" type="text/css" href="style/top.css" />
    <link rel="stylesheet" type="text/css" href="style/main.css" />
    <link rel="stylesheet" type="text/css" href="style/footer.css" />
    <link rel="stylesheet" type="text/css" href="style/reglog.css" />
    <link rel="stylesheet" type="text/css" href="style/manage.css" />
  </head>
  
  <body>
    <!-- 网页头部 -->
    <!-- head开始 -->
	<div id="hd">
    	<div class="wp">
        	<div class="hdc">
            	<div class="hd_bg_x">
                	<div id="hd_rt">
                        <span class="e_topmenu">
                        </span>
                        <h2>
                            <a href="index.jspx" title="编程之友BBS"></a>
                        </h2>
                        <div id="e_nv">
                            <div class="new_topbar">
                                <span class="new_topbar_left">
                                <c:choose>
                                	
                                	<c:when test="${not empty manager}">
                                		欢迎您！管理员： ${manager.username } <a href="user.jspx?_method=quit">[安全退出]</a>    
                                		<a href="user.jspx?_method=showusers" class="user">用户管理</a>
                                    <span class="pipe" style="margin: 0 5px;"> | </span>
                                    <a href="blocks.jspx?_method=manageblocks" class="blocks">板块管理</a>                      
                                    </c:when>
                                    
                                    <c:otherwise>
                                    
                                    </c:otherwise>
                                </c:choose>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	<!-- head结束 -->

   	<!-- 中间部分 -->
   	<div id="wp" class="wp">
   	<div class="main">
    	
        <div class="tablearea">
        <c:if test="${not empty userwithblocks}">
        <h3>版主列表</h3>
        	<div style="height: auto">
        	<table class="tb">
        		<tr>
        			<th>用户名</th>
        			<th>注册时间</th>
        			<th>积分</th>
        			<th>等级</th>
        			<th>email</th>
        			<th>在线状态</th>
        			<th>活跃度</th>
        			<th>管理的板块</th>
        			<th>操作</th>
        		</tr>
        		<c:forEach var="ub" items="${sessionScope.userwithblocks}">
        		<tr>
        			<td>${ub.username }</td>
        			<td>${ub.createdate }</td>
        			<td>${ub.score }</td>
        			<td>${ub.level }</td>
        			<td>${ub.email }</td>
        			<td><c:choose><c:when test="${ub.state }">在线</c:when>
        			<c:otherwise>离线</c:otherwise>
        			</c:choose>
        			</td>
        			<td>${ub.active }</td>
        			<td><c:forEach var="m" items="${ub.mlist}">
        			<a href="">${m.blocks.name}</a>&nbsp;
        			</c:forEach></td>
        			<td><a href="index.jspx?_method=choose&id=${ub.id }">取消版主</a>　<a href="user.jspx?_method=delete&id=${ub.id }">删除用户</a></td>
        		</tr>
        		</c:forEach>
        		<tr>
        			<td colspan="6"><hr/><a href="user.jspx?_method=showusers&page2=1">首页</a>　
        			<c:choose>
        			<c:when test="${page2.currentPage != 1}"><a href="user.jspx?_method=showusers&page2=${page2.currentPage - 1 }">上一页</a></c:when>
        			<c:otherwise>上一页</c:otherwise>
        			</c:choose>　
        			<c:choose><c:when test="${page2.currentPage != page2.totlePages}"><a href="user.jspx?_method=showusers&page2=${page2.currentPage + 1 }">下一页</a></c:when>
        			<c:otherwise>下一页</c:otherwise>
        			</c:choose>　
        			<a href="user.jspx?_method=showusers&page2=${page2.totlePages }">尾页</a></td>
        		</tr>
        		<c:remove var="userwithblocks" scope="session"/>
			</table>
			</div>
        </c:if> 
        <div class="clear"></div>
        	<c:if test="${not empty sessionScope.userlist}">
        	<h3>普通用户列表</h3>
        	<table class="tb">
        		<tr>
        			<th>用户名</th>
        			<th>注册时间</th>
        			<th>积分</th>
        			<th>等级</th>
        			<th>email</th>
        			<th>在线状态</th>
        			<th>活跃度</th>
        			<th>操作</th>
        		</tr>
        		<c:forEach var="u" items="${sessionScope.userlist}">
        		<tr>
        			<td>${u.username }</td>
        			<td>${u.createdate }</td>
        			<td>${u.score }</td>
        			<td>${u.level }</td>
        			<td>${u.email }</td>
        			<td><c:choose><c:when test="${u.state }">在线</c:when>
        			<c:otherwise>离线</c:otherwise>
        			</c:choose>
        			</td>
        			<td>${u.active }</td>
        			<td><a href="index.jspx?_method=setmoderator&id=${u.id }">设为版主</a>　<a href="user.jspx?_method=delete&id=${u.id }">删除用户</a></td>
        		</tr>
        		</c:forEach>
        		<tr>
        			<td colspan="6"><hr/><a href="user.jspx?_method=showusers&page1=1">首页</a>　
        			<c:choose>
        			<c:when test="${page1.currentPage != 1}"><a href="user.jspx?_method=showusers&page1=${page1.currentPage - 1 }">上一页</a></c:when>
        			<c:otherwise>上一页</c:otherwise>
        			</c:choose>　
        			<c:choose><c:when test="${page1.currentPage != page1.totlePages}"><a href="user.jspx?_method=showusers&page1=${page1.currentPage + 1 }">下一页</a></c:when>
        			<c:otherwise>下一页</c:otherwise>
        			</c:choose>　
        			<a href="user.jspx?_method=showusers&page1=${page1.totlePages }">尾页</a></td>
        		</tr>
        	</table>
        	<c:remove var="userlist" scope="session"/>
        	</c:if>
        </div>
    </div>
    </div>
    <div class="clear"></div>
      <!-- 网页底部 -->
    <%@include file="../template/footer.jsp" %>
  </body>
</html>
